package zhishuang.wang.sansi.playlist.entry;

/**
 * @Author Zhishuang.Wang
 * @Date 2023/7/5 11:09
 * @Email 1406110602@qq.com
 */
import zhishuang.wang.sansi.tools.ReturnData;

public class AudioBase {
    private Integer audit;
    private Integer audioType;
    private String audioPath;
    private Integer volume;

    public AudioBase(int audit, int audioType, String audioPath, int volume) {
        this.audit = audit;
        this.audioType = audioType;
        this.audioPath = audioPath;
        this.volume = volume;
    }

    public ReturnData checkParam() {
        ReturnData rd = new ReturnData();
        rd.setCode(1);
        String errorMes = "";
        if (this.audit != null && (this.audit < 0 || this.audit > 1)) {
            errorMes = errorMes + "是否审计，取值范围：0 或 1；";
        }

        if (this.audioType != null) {
            if (this.audioType < 0 || this.audioType > 1) {
                errorMes = errorMes + "音频类型，取值范围：0 - 2；";
            }

            if (this.audioPath == null || this.audioPath.length() == 0) {
                errorMes = errorMes + "音频文件路径必填；";
            }

            if (this.volume != null) {
                if (this.volume < 0 || this.volume > 100) {
                    errorMes = errorMes + "音量大小 取值范围：0 - 100；";
                }
            } else {
                errorMes = errorMes + "音量大小必填且取值范围：0 - 100；";
            }
        }

        if (errorMes != null && errorMes.length() != 0) {
            rd.setMessage(errorMes);
        } else {
            rd.setCode(0);
        }

        return rd;
    }

    public Integer getAudit() {
        return this.audit;
    }

    public void setAudit(Integer audit) {
        this.audit = audit;
    }

    public Integer getAudioType() {
        return this.audioType;
    }

    public void setAudioType(Integer audioType) {
        this.audioType = audioType;
    }

    public String getAudioPath() {
        return this.audioPath;
    }

    public void setAudioPath(String audioPath) {
        this.audioPath = audioPath;
    }

    public Integer getVolume() {
        return this.volume;
    }

    public void setVolume(Integer volume) {
        this.volume = volume;
    }
}

